<!DOCTYPE html>
<html id="html">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <style>
    html,
    body,
    #app {
      height: 100%;
      margin: 0;
      padding: 0;
    }

    .preload {
      display: flex;
      flex-direction: column;
      height: 100%;
      letter-spacing: 1px;
      background-color: #2f3447;
    }

    .preload .container {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      width: 100%;
      user-select: none;
      flex-grow: 1;
    }

    .preload .name {
      font-size: 30px;
      color: #fff;
      letter-spacing: 5px;
      font-weight: bold;
    }

    .preload .title {
      color: #fff;
      font-size: 14px;
      margin: 20px;
    }

    .preload .sub-title {
      color: #ababab;
      font-size: 12px;
    }

    .preload .footer {
      text-align: center;
      padding: 10px 0 20px 0;
    }

    .preload .footer a {
      font-size: 12px;
      color: #ababab;
      text-decoration: none;
    }
  </style>
  <title></title>
</head>
<body>
<noscript>
  <strong>We're sorry but iview-admin doesn't work properly without JavaScript enabled. Please enable it to
    continue.</strong>
</noscript>
<div id="app">
  <div class="preload">
    <div class="container" id="container">
      <p class="name" id="name">伙食保障精细管理系统</p>
      <p class="title">正在加载资源...</p>
      <p class="sub-title">初次加载资源可能需要较多时间 请耐心等待</p>
    </div>

    <div class="footer">
      <a href="" target="_blank" id="aBlank">伙食保障精细管理系统</a>
    </div>
  </div>
  <script>
    const systemCode=localStorage.getItem('systemCode');
    if(systemCode == 'business'){
      document.getElementById('name').innerText='智厨业务管理系统';
      document.getElementById('aBlank').innerText='智厨业务管理系统';
    }
 </script>
</div>
<!-- built files will be auto injected -->
</body>
<script>
  // systemCode == 'business' ?document.getElementsByName('name').innerHtml('智厨业务管理系统'):document.getElementsByName('name').innerHtml('伙食保障精细管理系统')
  // 自动计算图片大小
  window.autosize = (ImgD, h, w) => {
    var image = new Image();
    image.src = ImgD.src;
    image.onload = () => {
      if (image.width < w && image.height < h) {
        ImgD.width = image.width;
        ImgD.height = image.height;
      } else {
        if (w / h <= image.width / image.height) {
          ImgD.width = w;
          ImgD.height = w * (image.height / image.width);
        } else {
          ImgD.width = h * (image.width / image.height);
          ImgD.height = h;
        }
      }
    }
  }
  (function flexible(window, document) {
    var docEl = document.documentElement
    var dpr = window.devicePixelRatio || 1

    // adjust body font size
    function setBodyFontSize() {
      if (document.body) {
        document.body.style.fontSize = (12 * dpr) + 'px'
      } else {
        document.addEventListener('DOMContentLoaded', setBodyFontSize)
      }
    }

    setBodyFontSize();

    // set 1rem = viewWidth / 10
    function setRemUnit() {
      var docEl = document.documentElement
      var rem = docEl.clientWidth / 10
      if (document.getElementById("login-form")) {

        if (rem > docEl.style.fontSize.split('px')[0] && document.body.clientHeight - document.getElementById("login-form").offsetHeight < 150) {
          return;
        }
      }
      docEl.style.fontSize = (rem > 180 ? 180 : rem) + 'px'
    }

    setRemUnit()
    window.setRemUnit = setRemUnit;

    // reset rem unit on page resize
    // window.addEventListener('resize', setRemUnit)
    window.addEventListener('pageshow', function (e) {
      if (e.persisted) {
        setRemUnit()
      }
    })

    // detect 0.5px supports
    if (dpr >= 2) {
      var fakeBody = document.createElement('body')
      var testElement = document.createElement('div')
      testElement.style.border = '.5px solid transparent'
      fakeBody.appendChild(testElement)
      docEl.appendChild(fakeBody)
      if (testElement.offsetHeight === 1) {
        docEl.classList.add('hairlines')
      }
      docEl.removeChild(fakeBody)
    }
  }(window, document))
</script>
</html>
